package com.cars.client.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.web.SecurityFilterChain;

/**
 * @author Yang douya
 * @date 2023/6/19 15:40
 */
@Configuration
public class BootAdminMonitorSecurityConfig {

    /**
     * 增加 springboot 服务端安全验证 解决客户端注册报401
     *
     * @param http http
     */
    @Bean
    protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
        return http.authorizeHttpRequests((authorizeRequests) -> authorizeRequests.anyRequest().permitAll())
                .csrf(AbstractHttpConfigurer::disable).build();
    }
}